<!--{template header}-->

<!--{if $op == "buy"}-->

	<h1>购买道具</h1>
	<a class="float_del" title="关闭" href="javascript:hideMenu();">关闭</a>
	<div class="toolly" id="__magicbuy_$mid">
	<!--{if $ac=='magic'}-->	
		<form id="magicbuy_$mid" action="cp.php?ac=magic&mid=$mid&op=buy" method="post">
	<!--{else}-->		
		<form id="magicbuy_$mid" action="magic.php?mid=$mid&op=buy&idtype=$idtype&id=$id{$extra}" method="post">
	<!--{/if}-->
			<div class="magic_img">
				<img src="image/magic/{$mid}.gif" alt="$magic[name]" />
			</div>
			<div class="magic_info">
				<h3>$magic[name]</h3>
				<p class="gray">$magic[description]</p>
				<!--{if $magic[experience]}-->
				<p>增加经验: <span>$magic[experience]</span></p>
				<!--{/if}-->
				<p>
					道具单价: <span>$magic[charge]</span> 积分
					<!--{if $discount > 0}-->
					（享受 $discount 折优惠 <span>$charge</span> 积分 ）
					<!--{elseif $discount < 0}-->
					（享受 <span>免费</span> 折扣 ）
					<!--{/if}-->				
				</p>
				<p>现有库存: <span>$magicstore[storage]</span> 个</p>
				<p>购买数量: <input class="t_input" type="text" name="buynum" value="1" style="width:40px;" /> 个（当前最多可购买 $magicstore[maxbuy] 个）</p>
				<!--{if $coupon[count]}-->
				<p>用代金券: <input class="t_input" type="text" name="coupon" value="0" style="width:40px;" /> 张（每张抵用 100 积分，拥有 {$coupon[count]} 张）</p>
				<!--{/if}-->
				<p class="btn_line">
					<input type="hidden" name="formhash" value="<!--{eval echo formhash()}-->" />
					<input type="hidden" name="refer" value="$_SGLOBAL[refer]"/>
					<input type="hidden" name="buysubmit" value="1" />
				<!--{if $_SGLOBAL[inajax]}-->
					<!--{if $ac=='magic'}-->
					<input type="button" class="submit" id="buysubmit_btn" value="购买" onclick="ajaxpost('magicbuy_$mid', 'magicBought', 2000)" />
					<!--{else}-->
					<input type="button" class="submit" id="buysubmit_btn" value="购买" onclick="ajaxpost('magicbuy_$mid')" />
					<!--{/if}-->
				<!--{else}-->
					<input type="submit" class="submit" id="buysubmit_btn" value="购买">
				<!--{/if}-->
				</p>
			</div>
		</form>
	</div>

<!--{elseif $op == "present"}-->

	<h1>赠送道具</h1>
	<a class="float_del" title="关闭" href="javascript:hideMenu();">关闭</a>
	<div class="popupmenu_inner" id="__magicpresent_$mid">
		<form id="magicpresent_$mid" action="cp.php?ac=magic&mid=$mid" method="post">
			<p>
				要赠送的道具：$magic[name]
			</p>
			<p>
				好友的用户名：
				<input type="text" name="fusername" />
			</p>
			<p class="btn_line">
				<input type="hidden" name="formhash" value="<!--{eval echo formhash()}-->" />
				<input type="hidden" name="refer" value="$_SGLOBAL[refer]"/>
				<input type="hidden" name="presentsubmit" value="1" />
				<!--{if $_SGLOBAL[inajax]}-->
				<input type="button" class="submit" name="presentsubmit_btn" value="赠送" onclick="ajaxpost('magicpresent_$mid', 'magicPresent', 2000)" />
				<!--{else}-->
				<input type="submit" class="submit" name="presentsubmit_btn" value="赠送">
				<!--{/if}-->
			</p>
		</form>
	</div>
<!--{elseif $op == "showusage"}-->

	<h1>道具使用示例图</h1>
	<a class="float_del" title="关闭" href="javascript:hideMenu();">关闭</a>
	<div class="popupmenu_inner">
		<img src="image/magic/usage/{$mid}.gif" />		
	</div>
	
<!--{elseif $op == 'appear'}-->

	<h1>恢复在线状态</h1>
	<a class="float_del" title="关闭" href="javascript:hideMenu();">关闭</a>
	<div class="popupmenu_inner" id="__appearform">
	<form action="cp.php?ac=magic&op=$op" method="post" id="appearform">
		<p>
			您确定要取消隐身效果，恢复在线状态吗？
		</p>
		<p class="btn_line">
			<input type="hidden" name="formhash" value="<!--{eval echo formhash()}-->" />
			<input type="hidden" name="refer" value="$_SGLOBAL[refer]"/>
			<input type="hidden" name="appearsubmit" value="1" />
			<input type="submit" class="submit" value="确定" />
		</p>
	</form>
	</div>

<!--{elseif $op == 'retrieve'}-->

	<h1>回收红包</h1>
	<a class="float_del" title="关闭" href="javascript:hideMenu();">关闭</a>
	<div class="popupmenu_inner" id="__retrieveform">
	<form action="cp.php?ac=magic&op=$op" method="post" id="retrieveform">
		<p>
			红包当前剩余积分 $leftcredit ，您确定要回收吗？
		</p>
		<p class="btn_line">
			<input type="hidden" name="formhash" value="<!--{eval echo formhash()}-->" />
			<input type="hidden" name="refer" value="$_SGLOBAL[refer]"/>
			<input type="hidden" name="retrievesubmit" value="1" />
			<input type="submit" class="submit" value="确定" />
		</p>
	</form>
	</div>

<!--{elseif in_array($op, array('cancelsuperstar', 'cancelflicker', 'cancelcolor', 'cancelframe', 'cancelbgimage'))}-->

	<h1>取消道具效果</h1>
	<a class="float_del" title="关闭" href="javascript:hideMenu();">关闭</a>
	<div class="popupmenu_inner" id="__cancelform">
	<form action="cp.php?ac=magic&op=$op&id=$_GET[id]&idtype=$_GET[idtype]" method="post" id="cancelform">
		<p>
			您确定要取消道具 $_SGLOBAL[magic][$mid] 的效果吗？
		</p>
		<p class="btn_line">
			<input type="hidden" name="formhash" value="<!--{eval echo formhash()}-->" />
			<input type="hidden" name="refer" value="$_SGLOBAL[refer]"/>
			<input type="hidden" name="cancelsubmit" value="1" />
			<input type="submit" class="submit" value="确定" />
		</p>
	</form>
	</div>
	
<!--{else}-->

	<h2 class="title"><img src="image/icon/magic.gif">道具中心</h2>
	<div class="tabs_header">
		<ul class="tabs">
			<li$actives[store]><a href="cp.php?ac=magic&view=store"><span>道具商店</span></a></li>
			<li$actives[me]><a href="cp.php?ac=magic&view=me"><span>我的道具</span></a></li>
			<li$actives[log]><a href="cp.php?ac=magic&view=log"><span>道具记录</span></a></li>
		</ul>
	</div>

	<div style="float:none;">

	<!--{if $_GET['view'] == "me"}-->
			
		<!--{if $mid}-->
		<p class="notice">
			当前只显示与你操作相关的单个道具，
			<a href="cp.php?ac=magic&view=$_GET[view]">点击此处查看全部道具</a>
		</p>
		<p>&nbsp;</p>
		<!--{/if}-->

		<!--{if $list}-->
		<ul id="magiclist" class="magic_list">
		<!--{loop $list $key=>$value}-->
			<li id="magic_$key">
				<div class="magic_img">
					<img src="image/magic/{$key}.gif" alt="$magics[$key][name]" />
				</div>
				<div class="magic_info">
					<h3>$magics[$key][name]</h3>
					<p class="gray">
					$magics[$key][description]
					</p>
					<p>
						<a id="a_present_$key" href="cp.php?ac=magic&op=present&mid=$key" onclick="ajaxmenu(event, this.id, 1)" class="m_button<!--{if $key=='license'}--> m_off<!--{/if}-->">赠送</a>
						拥有 <span id="magiccount_$key">$value[count]</span> 个
					</p>
				</div>
			</li>
		<!--{/loop}-->
		</ul>
		<!--{else}-->
		<p>您还没有购买任何道具，<a href="cp.php?ac=magic&view=store">去道具商店看看</a></p>
		<!--{/if}-->
	<!--{elseif $_GET['view'] == 'log'}-->

		<div class="h_status">
		查看：
		<a $types[in] href="cp.php?ac=magic&view=$_GET['view']&type=in">获得记录</a>
		<span class="pipe">|</span>
		<a $types[present] href="cp.php?ac=magic&view=$_GET['view']&type=present">赠送记录</a>
		<span class="pipe">|</span>
		<a $types[out] href="cp.php?ac=magic&view=$_GET['view']&type=out">使用记录</a>
		</div>

		<!--{if $_GET[type] == 'in'}-->
			<!--{if $list}-->
			<ul class="line_list">
				<!--{loop $list $value}-->
				<li>
					
					<!--{if $value[type] == '3'}-->
					升级获得
					<!--{elseif $value[type] == '2'}-->
					获得了
					<!--{if $value[fromid]}-->
					<a href="space.php?uid=$value[fromid]" target="_blank">$_SN[$value[fromid]]</a>
					<!--{else}-->
					管理员
					<!--{/if}-->
					赠送的
					<!--{else}-->
					购买了
					<!--{/if}-->
					<a href="cp.php?ac=magic&view=store&mid=$value[mid]" target="_blank">
						$_SGLOBAL[magic][$value[mid]]
					</a>
					$value[count]
					个
					<span class="gray">(<!--{eval echo sgmdate('m-d H:i', $value[dateline], true)}-->)</span>
				</li>
				<!--{/loop}-->
			</ul>
			<div class="page">$multi</div>
			<!--{else}-->
			<p>您近期没有道具收入记录</p>
			<!--{/if}-->
		<!--{elseif $_GET[type] == 'present'}-->
			<!--{if $list}-->
			<ul class="line_list">
				<!--{loop $list $value}-->
				<li>
					向
					<a href="space.php?uid=$value[uid]">$_SN[$value[uid]]</a>
					赠送了
					<a href="cp.php?ac=magic&view=store&mid=$value[mid]" target="_blank">
						$_SGLOBAL[magic][$value[mid]]
					</a>
					<span class="gray">(<!--{eval echo sgmdate('m-d H:i', $value[dateline], true)}-->)</span>
				</li>
				<!--{/loop}-->
			</ul>
			<div class="page">$multi</div>
			<!--{else}-->
			<p>您近期没有向他人赠送道具的记录</p>
			<!--{/if}-->		
		<!--{else}-->
			<!--{if $list}-->
			<ul class="line_list">
				<!--{loop $list $value}-->
				<li>
					使用了
					<a href="cp.php?ac=magic&view=store&mid=$value[mid]" target="_blank">
						$_SGLOBAL[magic][$value[mid]]
					</a>
					$value[count] 次
				<!--{if $value['mid'] == 'invisible'}-->
					; &nbsp;失效时间：<!--{eval echo sgmdate('m-d H:i', $value[expire])}-->
				<!--{elseif $value['mid'] == 'gift'}-->
					; &nbsp;剩余积分数：$value[data][left]
				<!--{elseif $value['mid'] == 'superstar'}-->
					; &nbsp;失效时间：<!--{eval echo sgmdate('m-d H:i', $value[expire])}-->
				<!--{/if}-->
					<span class="gray">(<!--{eval echo sgmdate('m-d H:i', $value[dateline], true)}-->)</span>
				</li>
				<!--{/loop}-->
			</ul>
			<div class="page">$multi</div>
			<!--{else}-->
			<p>您近期没有道具使用记录</p>
			<!--{/if}-->
		<!--{/if}-->

	<!--{else}-->
		<div class="h_status">
		排序：
		<a $orders['default'] href="cp.php?ac=magic&view=$view&order=defalut">默认</a>
		<span class="pipe">|</span>
		<a $orders['hot'] href="cp.php?ac=magic&view=$view&order=hot">热门</a>
		</div>

		<!--{if $mid}-->
		<p class="notice">
			当前只显示与你操作相关的单个道具，
			<a href="cp.php?ac=magic&view=$_GET[view]">点击此处查看全部道具</a>
		</p>
		<p>&nbsp;</p>
		<!--{/if}-->

		<ul id="magiclist" class="magic_list">
		<!--{loop $list $key=>$value}-->
			<li id="magic_$key">
				<div class="magic_img">
					<a id="a_i_buy_$key" href="cp.php?ac=magic&op=buy&mid=$key" onclick="ajaxmenu(event, this.id, 1)">
					<img src="image/magic/{$key}.gif" alt="$magics[$key][name]" />
					</a>
				</div>
				<div class="magic_info">
					<h3>
						$magics[$key][name]
						<!--{if $_GET[order] == 'hot'}-->
						<small class="gray" style="margin-left:10px;">已售出 $value[sellcount] 件</small>
						<!--{/if}-->
					</h3>
					<p class="gray">$magics[$key][description]</p>
					<p>
						<!--{if in_array($space[groupid], $magics[$key][forbiddengid]) || in_array($mid, $blacklist)}-->
						<a id="a_buy_$key" href="cp.php?ac=magic&op=buy&mid=$key" onclick="ajaxmenu(event, this.id, 1)" class="m_button m_off">不能购买</a><span>$magics[$key][charge]</span> 积分/个
						<!--{else}-->
						<a id="a_buy_$key" href="cp.php?ac=magic&op=buy&mid=$key" onclick="ajaxmenu(event, this.id, 1)" class="m_button">购买</a><span>$magics[$key][charge]</span> 积分/个
						<!--{/if}-->
					</p>
				</div>
			</li>
		<!--{/loop}-->
		</ul>
	<!--{/if}-->

	</div><!--//<div id="content" style="float:none;width:690px;">//-->
	<script type="text/javascript">
	<!--
	function magicBought(id, result) {
		var ids = explode('_', id);
		var mid = ids[1];
		if($('a_buy_'+mid)) {
			$('a_buy_'+mid).innerHTML = '继续购买';
		}
	}
	function magicPresent(id, result) {
		var ids = explode('_', id);
		var mid = ids[1];
		if($('a_present_'+mid)) {
			$('a_present_'+mid).innerHTML = '继续赠送';
		}
		if($('magiccount_'+mid)) {
			$('magiccount_'+mid).innerHTML = parseInt($('magiccount_'+mid).innerHTML) - 1;
		}
	}
	-->
	</script>

<!--{/if}-->

<!--{template footer}-->